package Demo1;
import java.io.FileNotFoundException;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-07-13
 * Time: 20:38
 */
public class Test1 {
    public static void fun(String filename) throws FileNotFoundException {
        if (!filename.equals("test.txt")) {
            throw new FileNotFoundException("文件名错误");
        }
    }
    public static void main(String[] args){
            try{
                fun("java.txt");
                System.out.println("测试文本");
            }catch(FileNotFoundException e){
                System.out.println("执行catch");
                e.printStackTrace();
            }catch(NullPointerException |ArrayIndexOutOfBoundsException e){
                System.out.println("发生错误");
            }finally{
                System.out.println("判断结束");
            }
            System.out.println("异常处理完毕，继续执行...");
    }
}
